<?php
/**
 * Describe:
 * Source:
 * User: blue
 * Time: 2018/3/18 18:23
 */

namespace app\admin\validate;


use think\Validate;

class Rule extends Validate
{
    //验证规则
    protected $rule=[
        'id'=>'require',
        'title'=>'require|token',
        'name'=>'require|length:2,50',
        'nav'=>'require|length:2,100',
    ];
    //验证信息
    protected $message=[
        'id.require'=>'id必须选择',
        'title.require'=>'用户名必须填写',
        'name.require'=>'用户名必须填写',
        'name.length'=>'用户名长度不符合标准',
        'nav.require'=>'导航必须填写',
        'nav.length'=>'导航长度不符合标准'
    ];
    //验证场景
    protected $scene=[
        'add'=>['title','name','nav'],
        'del'=>['id']
    ];
}